//
//  UserAccountTool.swift
//  IFXY
//
//  Created by LiuXing on 2017/1/1.
//  Copyright © 2017年 IFly. All rights reserved.
//

import UIKit

class UserAccountTool: NSObject {
    // 将类设计成单例
    static let shareIntance : UserAccountTool = UserAccountTool()
    
    // account属性
    var account: UserAccount?
    
    
    //获取路径
    var accountPath : String {
        let accountPath = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true).first!
        let components: [String] = ["\(accountPath)", "accout.plist"]
        let path = NSString.path(withComponents: components)
        return path
    }
    
    override init () {
        super.init()
        // 从沙盒中读取中归档的信息
        account = NSKeyedUnarchiver.unarchiveObject(withFile: accountPath) as? UserAccount
    }
    
}
